The Recommend widgets are part of React InstantSearch. Learn how you can upgrade from Recommend React.
react-instantsearch
and algoliasearch
packages to your project,
and remove the @algolia/recommend
and @algolia/recommend-js
packages:
<TrendingFacets>
componentuseTrendingFacets()
HookuseRecommendations()
Hook<Recommend>
context providerinstantsearch component. Pass the API client and index name to the
InstantSearch` component:
Recommend React | React InstantSearch | Changes |
---|---|---|
<FrequentlyBoughtTogether> | frequently-bought-together | Prop changes |
<RelatedProducts> | related-products | Prop changes |
<TrendingItems> | trending-items | Prop changes |
<TrendingFacets> | Removed | Alternative |
<LookingSimilar> | looking-similar | Prop changes |
<Recommend> | Removed | Alternative |
<FrequentlyBoughtTogether>
recommendClient
and indexName
to <InstantSearch>
frequently-bought-together
component no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
children
and view
with the layoutComponent
prop or the useFrequentlyBoughtTogether()
Hookfrequently-bought-together
component no longer provides children
and view
props.
To fully customize the UI, use either the layoutComponent
prop or the frequently-bought-together` Hook instead.
fallbackComponent
with emptyComponent
emptyComponent
prop replaces the fallbackComponent
prop.
maxRecommendations
with limit
limit
prop replaces the maxRecommendations
prop.
environment
environment
prop is no longer needed.
classNames
classNames
keys have changed.
<RelatedProducts>
recommendClient
and indexName
to <InstantSearch>
related-products
component no longer needs recommendClient
and indexName
props. Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
children
and view
with the layoutComponent
prop or the useRelatedProducts()
Hookrelated-products
component no longer provides children
and view
props.
To fully customize the UI, use either the layoutComponent
prop or the related-products
Hook instead.
fallbackComponent
with emptyComponent
emptyComponent
prop replaces the fallbackComponent
prop.
maxRecommendations
with limit
limit
prop replaces the maxRecommendations
prop.
The related-products
component now takes an optional maxRecommendations
prop which replaces limit
.
environment
environment
prop is no longer needed.
classNames
classNames
keys have changed.
<TrendingItems>
recommendClient
and indexName
to <InstantSearch>
trending-items
component no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
children
and view
with the layoutComponent
prop or the useTrendingItems()
Hooktrending-items
component no longer provides children
and view
props.
To fully customize the UI, use either the layoutComponent
prop or the trending-items
Hook instead.
fallbackComponent
with emptyComponent
emptyComponent
prop replaces the fallbackComponent
prop.
maxRecommendations
with limit
limit
prop replaces the maxRecommendations
prop.
environment
environment
prop is no longer needed.
classNames
classNames
keys have changed.
<TrendingFacets>
<TrendingFacets>
component isn’t available in React InstantSearch.
If you need it, use the <TrendingFacets>
component from the deprecated Recommend React library.
<LookingSimilar>
recommendClient
and indexName
to <InstantSearch>
looking-similar
component no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
children
and view
with the layoutComponent
prop or the useLookingSimilar()
Hooklooking-similar
component no longer provides children
and view
props.
To fully customize the UI, use either the layoutComponent
prop or the looking-similar
Hook instead.
fallbackComponent
with emptyComponent
emptyComponent
prop replaces the fallbackComponent
prop.
maxRecommendations
with limit
limit
prop replaces the maxRecommendations
prop.
environment
environment
prop is no longer needed.
classNames
classNames
keys have changed.
Recommend React | React InstantSearch | Changes |
---|---|---|
useFrequentlyBoughtTogether() | frequently-bought-together | Prop changes |
useRelatedProducts() | related-products | Prop changes |
useTrendingItems() | trending-items | Prop changes |
useTrendingFacets() | Removed | Alternative |
useLookingSimilar() | looking-similar | Prop changes |
useRecommendations() | Removed | Alternative |
useFrequentlyBoughtTogether()
recommendClient
and indexName
to <InstantSearch>
frequently-bought-together
Hook no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
recommendations
with items
frequently-bought-together
Hook returns recommendations under the items
key instead of recommendations
.
useRelatedProducts()
recommendClient
and indexName
to <InstantSearch>
related-products
Hook no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
recommendations
with items
related-products
Hook returns recommendations under the items
key instead of recommendations
.
useTrendingItems()
recommendClient
and indexName
to <InstantSearch>
trending-items
Hook no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
recommendations
with items
trending-items
Hook returns recommendations under the items
key instead of recommendations
.
useTrendingFacets()
useTrendingFacets()
Hook isn’t available in React InstantSearch.
If you need it, use the useTrendingFacets()
Hook from the deprecated Recommend React library.
useRecommendations()
useRecommendations()
Hook isn’t available in React InstantSearch.
Instead, use the dedicated Hooks for each Recommend model.
useLookingSimilar()
recommendClient
and indexName
to <InstantSearch>
looking-similar
Hook no longer needs recommendClient
and indexName
props.
Instead, pass a searchChlient
and the ìndexName
to instantsearch
.
recommendations
with items
looking-similar
Hook returns recommendations under the items
key instead of recommendations
.
<Recommend>
context provider<Recommend>
context provider is no longer necessary to batch requests.
Remove it from your implementation.
HorizontalSlider
HorizontalSlider
component is now available in React InstantSearch as the Carousel
component.
For Carousel
props, check the API reference:
<FrequentlyBoughtTogether>
<RelatedProducts>
<TrendingItems>
<LookingSimilar>